package gk.example.adapter;

import java.util.List;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

/**
 * 
 * Description:MainActivity图片轮播Adapter
 * 
 * @author Wenk.Chan（最新修改者）
 * @version 1.0（最新版本号）
 */
public class AutoScrollAdapter extends PagerAdapter {
	private List<View> mPicList;

	public AutoScrollAdapter(List<View> picList) {
		mPicList = picList;
	}

	@Override
	public int getCount() {
		return mPicList.size();
	}

	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		container.addView(mPicList.get(position));
		return mPicList.get(position);
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		container.removeView(mPicList.get(position));
	}

	@Override
	public int getItemPosition(Object object) {
		// TODO Auto-generated method stub
		return super.getItemPosition(object);
	}

}
